package org.wkg.lesson09;

import java.util.concurrent.TimeUnit;

public class Demo_903 {

    public static void main(String[] args) throws InterruptedException {
        MyThreadPool threadPool = new MyThreadPool(3);

        for (int i = 0; i < 10; i++) {
            int TaskId = i + 1;

            threadPool.submit(() -> {
                System.out.println("执行任务：" + TaskId + "  " + Thread.currentThread().getName());
            });
            if (TaskId % 2 == 0) {
                TimeUnit.SECONDS.sleep(1);
            }
        }
    }


}
